#include <iostream>

using namespace std;

int main()
{
	int iMyAge = 19;
	int* const pMyAge = &iMyAge;

	const float fPi = 3.142;
	const float* pPi = &fPi;

	const bool bYes = true;
	const bool* const pYes = &bYes;

	cout << "First, the integer, storing my age. iMyAge = " << iMyAge << endl;
	cout << "iMyAge is stored at: " << pMyAge << endl;
	cout << "pMyAge, the constant pointer, says the value is: " << *pMyAge << endl << endl;

	cout << "Second, the constant float, storing Pi. fPi = " << fPi << endl;
	cout << "fPi is stored at: " << pPi << endl;
	cout << "pPi, the pointer, says the value is: " << *pPi << endl << endl;

	cout << "Last, the constant bool, storing... uhh... yes? bYes = " << bYes << endl;
	cout << "bYes is stored at: " << pYes << endl;
	cout << "pYes, the constant pointer, says the value is: " << *pYes << endl << endl;

	cout << "pMyAge is a constant pointer. So we can't reallocate it." << endl;
	cout << "However, iMyAge (which pMyAge points to) isn't constant." << endl;
	cout << "My birthday is soon, so lets add 1 to it! (*pMyAge)++ should work!" << endl;
	(*pMyAge)++;
	cout << "iMyAge is now: " << iMyAge << " and *pMyAge is: " << *pMyAge << " and it's still stored at: " << pMyAge << endl << endl;

	cout << "fPi is a constant, but pPi (the pointer that points to it) isn't!" << endl;
	cout << "We can re-assign pPi to any constant float, so lets do that now!" << endl;
	const float fLife = 42.0;
	pPi = &fLife;
	cout << "pPi now points to fLife. The new address is " << pPi << " and value is: " << *pPi << endl << endl;

	cout << "We can't screw with pYes because it is a constant pointer to a constant bool!" << endl << endl;

	cout << "It's a pointer/constant adventure. The End!" << endl;

	cin.get();

	return 0;
}